package com.yigo.framework.base;

import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.Version;
import com.tangzc.mpe.annotation.DefaultValue;
import com.tangzc.mpe.annotation.InsertOptionDate;
import com.tangzc.mpe.annotation.InsertUpdateOptionDate;
import com.tangzc.mpe.autotable.annotation.Column;
import com.tangzc.mpe.autotable.annotation.ColumnComment;
import com.tangzc.mpe.autotable.annotation.Ignore;
import com.yigo.framework.snapshot.PoSnapshot;
import lombok.Data;

import java.time.LocalDateTime;

@Data
public class BasePO implements PoSnapshot {
    /**
     * 忽略该字段，不参与建表
     */
    @Ignore
    private Object snapshot;
    /**
     * 创建时间
     */
    @InsertOptionDate
    @ColumnComment("创建时间")
    private LocalDateTime createTime;
    /**
     * 最后更新时间
     */
    @InsertUpdateOptionDate
    @ColumnComment("最后更新时间")
    private LocalDateTime updateTime;
    /**
     * 乐观锁版本号
     */
    @Version
    @Column(comment = "乐观锁版本号", length = 10, notNull = true,defaultValue = "0")
    private Integer version;
    /**
     * 逻辑删除标志
     */
    @TableLogic
    @DefaultValue("0")
    @ColumnComment("逻辑删除标志:0-否；1-是")
    protected Integer deleted;
}
